package com.yang.service.impl;

import com.yang.dao.UserMapper;
import com.yang.entity.User;
import com.yang.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by Administrator on 2019/6/30.
 */
@Service
public class UserServiceImpl implements UserService{
    @Autowired
   private UserMapper userMapper;

    /**
     * 注册功能
     * @param user
     * @return
     */
    @Override
    public int resgister(User user) {
        if (userMapper.selectByPrimaryKey(user.getUid()) == null) {
            return -1;
        } else {
            return userMapper.insert(user);
        }
    }

    /**
     * 根据姓名和密码进行查询登陆
     * @param username
     * @param password
     * @return
     */
    @Override
    public User selectByPasswordAndName(String username, String password) {
        return userMapper.selectByPasswordAndName(username,password);
    }





    @Override
    public void reviseName(User user) {

    }

    @Override
    public void revisePwd(User user) {

    }
}
